﻿using System.Data;
using Dqaqs.Services.Data;

namespace Dqaqs.Implemenation.Basic
{
	public class BasicDataSource : IDataSource
	{
		private readonly string _name;
		private readonly Schema _schema;
		private readonly IQueryExecuter _queryExecutionService;

		public string Name
		{
			get { return _name; }
		}

		public Schema Schema
		{
			get { return _schema; }
		}

		public DataTable RunQuery(IDqQuery query)
		{
			return _queryExecutionService.ExecuteQuery(this, query);
		}

		public BasicDataSource(string name, Schema schema, IQueryExecuter queryExecutionService)
		{
			_name = name;
			_schema = schema;
			_queryExecutionService = queryExecutionService;
		}
	}
}